<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        #app{
            width: 400px;
            height: 500px;
            border: 1px solid;

            position: relative;
        }
        #test{
            width: 100px;
            height: 100px;
            background: pink;
           /* position: absolute;
            top: 50%;  !*百分比参照于包含块的height*!
            left: 50%; !*百分比参照于包含块的width*!
            margin-left:-50px; !*百分比参照于包含块的width*!
            margin-top:-50px;  !*百分比参照于包含块的width*!*/


            /*绝对定位盒模型的特性*/
            position: absolute;
            left: 0;
            right: 0;
            top: 0;
            bottom: 0;
            margin: auto;
        }
    </style>
</head>
<body>
    <div id="app">
        <div id="test">

        </div>
    </div>
</body>

</html>